package cn.kgc.api.entity;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

@Setter
@Getter
public class CustomerUser  extends User {
    /**
     * 系统中的用户类
     */
    private Users sysUser;

    public CustomerUser(Users sysUser, Collection<? extends GrantedAuthority> authorities) {
        //调用父类的构造方法 传入当前登录的用户名  密码   用户的权限信息
        super(sysUser.getUserName(), "{bcrypt}" + sysUser.getUserPwd(), authorities);
        //封装系统中登录的用户信息
        this.sysUser = sysUser;
    }

}
